﻿@{
	Layout = null;
}
<link href="~/libs/layui-v2.9.21/layui-v2.9.21/layui/css/layui.css" rel="stylesheet" />


<div style="margin-left:20px;margin-top:40px">
	<form class="layui-form" action="">
	<div class="layui-form">
		<label class="layui-form-label">父分类</label>
		<div class="layui-input-block">
			<input type="text" id="orderBy" name="orderBy" disabled placeholder="请输入" autocomplete="off" class="layui-input">
		</div>
	</div>

	<div class="layui-form">
		<label class="layui-form-label">分类名称</label>
		<div class="layui-input-block">
			<input type="text" name="materialTypeName" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
		</div>
	</div>

	<div class="layui-form">
		<label class="layui-form-label">物料产品</label>
		<div class="layui-input-block">
			<input type="radio" name="products" value="物料" title="物料" checked>
			<input type="radio" name="products" value="产品" title="产品">
		</div>
	</div>

	<div class="layui-form">
		<label class="layui-form-label">启用状态</label>
		<div class="layui-input-block">
			<input type="radio" name="state" value="true" title="是" checked>
			<input type="radio" name="state" value="false" title="否">
		</div>
	</div>

	<div class="layui-form-item">
		<div class="layui-input-block">
			<button type="submit" class="layui-btn" lay-submit lay-filter="demo1">立即提交</button>
			<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			<button type="reset" class="layui-btn layui-btn-primary" onclick="returnList()">返回</button>
		</div>
		</div>
	</form>
</div>

<script src="~/libs/jquery/jquery.js"></script>
<script src="~/libs/layui-v2.9.21/layui-v2.9.21/layui/layui.js"></script>

<script>


	$(function(){
		Transfer();
	})

	function Transfer(){
		$("#orderBy").val(@ViewBag.orderBy)
	}

		layui.use(['form'],function(){
			var form=layui.form;
			var layer=layuil.layer;

			form.on('submit(demo1)',function(data){
				var field=data.field;

				$.ajax({
					url:'MaterialType/AddMaterialType',
					data:field,
					type:"post",
					dataType:"json",
					success:function(res){
					  if(res.code===0){

					  }else{
						  alert("添加失败");
					  }
					}
				})
			}
		}


</script>